<!DOCTYPE html>
<title>Check multiple buffered timeranges with video preload.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../../media-resources/media-file.js"></script>
<video preload="auto"></video>
<script>
async_test(function(t) {
    var video = document.querySelector("video");

    video.onended = t.step_func_done(function() {
        assert_equals(video.buffered.length, 2);
    });

    video.onplaying = t.step_func(function() {
        video.onplaying = null;
        video.currentTime = video.duration - 0.5;
    });

    // This test needs a large media file to test multiple buffered timeranges.
    var mediaFile = "../../../media/resources/frame_size_change.webm";
    var type = mimeTypeForExtension(mediaFile.split(".").pop());
    video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?nph=1&name=" + mediaFile + "&throttle=100000&type=" + type;
    video.play();
});
</script>